package cn.tannn.tconfig.server.controller.dto;

import cn.tannn.tconfig.server.model.Configs;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 添加Configs
 *
 * @author <a href="https://tannn.cn/">tan</a>
 * @date 2024/4/28 13:32
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ConfigsAdd {

    /**
     * 应用
     */
    private String app;
    /**
     * 环境
     */
    private String env;
    /**
     * namespace
     */
    private String ns;
    /**
     * 参数key
     */
    private String pkey;
    /**
     * 参数value
     */
    private String pval;


    public  ConfigsAdd(Configs configs) {
        this.app = configs.getApp();
        this.env = configs.getEnv();
        this.ns = configs.getNs();
        this.pkey = configs.getPkey();
        this.pval = configs.getPval();
    }

    public Configs toConfigs(){
        Configs configs = new Configs();
        configs.setApp(app);
        configs.setEnv(env);
        configs.setNs(ns);
        configs.setPkey(pkey);
        configs.setPval(pval);
        return configs;
    }
}
